<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"  uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <!--公共样式-->
    <link href="${pageContext.request.contextPath }/web/css/font/iconfont.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/web/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/web/css/NormalizeFile.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/web/css/public.css" />
    <!--列表页面私有样式-->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/web/css/subpage/person.css" />
</head>
<body class="w928">
<!--用户中心 begin-->
    <!--收货地址-->
    <div class="right-content bor1">
         <div class="bor1-t xx-top">
            <spring:message code="reciveAddress.goodsReceiptAddress"></spring:message>
        </div>
        <iframe id="anchorReciveAddress" scrolling="yes" width="908px;" height="480px;" frameborder="0" src="${pageContext.request.contextPath }/member/member/insertReciveAddress"></iframe>
        <div class="bor1-t address-mass">
            <ul class="bor1-t">
                <li class="head">
                    <div class="sp1"><spring:message code="reciveAddress.goodsReceiptPerson"></spring:message></div>
                    <div class="sp2"><spring:message code="reciveAddress.localArea"></spring:message></div>
                    <div class="sp3"><spring:message code="reciveAddress.detailedAddress"></spring:message></div>
                    <div class="sp4"><spring:message code="reciveAddress.zipCode"></spring:message></div>
                    <div class="sp5"><spring:message code="reciveAddress.telephoneOrMobilePhone"></spring:message></div>
                    <div class="sp6"><spring:message code="reciveAddress.operation"></spring:message></div>
                    <div class="sp7"></div>
                </li>
                <c:forEach items="${addresslist}" var="item">
                <li>
                    <div class="sp1 zichang"><span>${item.aName}</span></div>
                    <div class="sp2 zichang" title="${item.aAddress}"><span>${item.aAddress}</span></div>
                    <div class="sp3 zichang" title="${item.aAddressInfo}"><span>${item.aAddressInfo}</span></div>
                    <div class="sp4">${item.aCode}</div>
                    <div class="sp5">${item.aPhone}</div>
                    <div class="sp6"><a href="javascript:update(${item.aId})" class="modify-address"><spring:message code="reciveAddress.revise"></spring:message></a>|<a href="javascript:del(${item.aId})" class="delete-address"><spring:message code="reciveAddress.delete"></spring:message></a></div>
                    <c:if test="${item.aDefault==1}">
                    <div class="sp7"><a href="#" class="default-address"><spring:message code="reciveAddress.defaultAddress"></spring:message></a></div>
                    </c:if>
                    <c:if test="${item.aDefault==0}">
                    <div class="sp7"><a href="javascript:setdefault(${item.aId})" class="set-default-address"><spring:message code="reciveAddress.setAsDefault"></spring:message></a></div>
                    </c:if>
                </li>
                </c:forEach>
            </ul>
        </div>
    </div>
<!--用户中心 end-->
<!--全局-->
<script type="text/javascript" src="${pageContext.request.contextPath }/web/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/web/js/public.js"></script>
<!--ie789下placeholder不兼容-->
<script type="text/javascript" src="${pageContext.request.contextPath }/web/js/placeholder.js"></script>
<!--头部的以图搜图-->
<%-- <script type="text/javascript" src="${pageContext.request.contextPath }/web/js/uppicFile.js"></script> --%>
<!--用户中心-->
<script type="text/javascript" src="${pageContext.request.contextPath }/web/js/subpage/person.js"></script>
<script type="text/javascript">
	function setdefault(id){
		 $.ajax({
			 url:'${pageContext.request.contextPath }/web/address/setdefaultaddress',
			 async : false,
			 data: {aId:id},
			 type : "POST", 
			 success :function(result){
			 var status=result.msg.status;
			 var desc=result.msg.desc;
			 if(status == 0){
				 window.parent.layer.msg('<spring:message code="caozuochenggong"></spring:message>', {icon: 1,time: 1000}); 
				 location.reload(true);
			 }else if(status == 2){//没登录
				 window.parent.layer.msg('<spring:message code="weidenglu"></spring:message>', {icon: 0,time: 1000}); 
			    }else if(status ==1){//失败
			    	 window.parent.layer.msg("<spring:message code='caozuoshibai'></spring:message>", {icon: 0,time: 1000}); 
			    }
			 }
			 });
		 }
	function update(id){
		 $("#anchorReciveAddress").attr('src','${pageContext.request.contextPath }/web/address/viewddress/'+id);
		 }
	function del(id){
		 window.parent.layer.confirm('<spring:message code="reciveAddress.confirmDeletion"></spring:message>', {
      	  btn: ['<spring:message code="reciveAddress.confirm"></spring:message>','<spring:message code="reciveAddress.cancel"></spring:message>'], //按钮
      	  title:'<spring:message code="reciveAddress.message"></spring:message>'
      	}, function(index){
      		 $.ajax({
    			 url:'${pageContext.request.contextPath }/web/address/deladdress',
    			 async : false,
    			 data: {aId:id},
    			 type : "POST", 
    			 success :function(result){
    			 var status=result.msg.status;
    			 var desc=result.msg.desc;
    			 if(status == 0){
    				 window.parent.layer.msg('<spring:message code="shanchuchenggong"></spring:message>', {icon: 1,time: 1000}); 
    				 location.reload(true);
    			 }else if(status == 2){//没登录
    				 window.parent.layer.msg('<spring:message code="weidenglu"></spring:message>', {icon: 0,time: 1000}); 
    			    }else if(status ==1){//失败
    			    	 window.parent.layer.msg("<spring:message code='caozuoshibai'></spring:message>", {icon: 0,time: 1000}); 
    			    }
    			 }
    			 });
      	},function(index){
      		 window.parent.layer.close(index);
      	});
		 }
</script>
</body>
</html>